﻿using System;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations.Schema;
using YiSha.Util;

namespace YiSha.Entity.QixingManage
{
    /// <summary>
    /// 创 建：admin
    /// 日 期：2023-04-09 19:28
    /// 描 述：优惠劵实体类
    /// </summary>
    [Table("coupon")]
    public class CouponEntity : BaseEntity
    {
        /// <summary>
        /// 优惠卷标题
        /// </summary>
        /// <returns></returns>
        public string title { get; set; }
        /// <summary>
        /// 优惠劵金额
        /// </summary>
        /// <returns></returns>
        public decimal? coupon_price { get; set; }
        /// <summary>
        /// 使用门槛；0表示无门槛
        /// </summary>
        /// <returns></returns>
        public decimal? coupon_threshold_price { get; set; }
        /// <summary>
        /// 优惠劵生效时间
        /// </summary>
        /// <returns></returns>
        [JsonConverter(typeof(DateTimeJsonConverter))]
        public DateTime? start_time { get; set; }
        /// <summary>
        /// 优惠劵失效时间
        /// </summary>
        /// <returns></returns>
        [JsonConverter(typeof(DateTimeJsonConverter))]
        public DateTime? end_time { get; set; }
        /// <summary>
        /// 优惠劵发行数量
        /// </summary>
        /// <returns></returns>
        public int? create_num { get; set; }
        /// <summary>
        /// 用户限领数量
        /// </summary>
        /// <returns></returns>
        public int? limit_num { get; set; }
        /// <summary>
        /// 被使用数量
        /// </summary>
        /// <returns></returns>
        public int? used_num { get; set; }
        /// <summary>
        /// 被领取数量
        /// </summary>
        /// <returns></returns>
        public int? received_num { get; set; }
       
        /// <summary>
        /// 优惠券类型；0->全场赠券；1->会员赠券；2->购物赠券；3->注册赠券
        /// </summary>
        /// <returns></returns>
        public int? type { get; set; }
        /// <summary>
        /// 使用类型：0->全场通用；1->指定分类；2->指定店铺;3->指定商品
        /// </summary>
        /// <returns></returns>
        public int use_type { get; set; }
        /// <summary>
        /// 使用范围关联的ID(店铺为空，平台为0)
        /// </summary>
        /// <returns></returns>
        public string scope_id { get; set; }
        /// <summary>
        /// 商铺承担比例（店铺为空）
        /// </summary>
        /// <returns></returns>
        public int? shop_commission { get; set; }
        /// <summary>
        /// 使用范围说明
        /// </summary>
        /// <returns></returns>
        public string scope_desc { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        /// <returns></returns>
        public string note { get; set; }
        /// <summary>
        /// 可以领取的日期
        /// </summary>
        [JsonConverter(typeof(DateTimeJsonConverter))]
        public DateTime? enable_time { get; set; }

        /// <summary>
        /// 分类集合
        /// </summary>
        /// <returns></returns>
        [NotMapped]
        [JsonConverter(typeof(StringJsonConverter))]
        public long categoryid { get; set; }

        /// <summary>
        /// 商店集合
        /// </summary>
        /// <returns></returns>
        [NotMapped]
        public string shopids { get; set; }

        /// <summary>
        /// 商品集合
        /// </summary>
        /// <returns></returns>
        [NotMapped]
        public string goodsids { get; set; }

        /// <summary>
        /// 租户ID
        /// </summary>
        [JsonConverter(typeof(DateTimeJsonConverter))]
        public long? tenant_id { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        [NotMapped]
        public int status { get; set; }
    }
}
